﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;

namespace Part3_IndividuleAssignment2.ViewModels
{

    public class SubmitNews
    {

        const string EMAIL_REGEX =
                  @"^(([^<>()[\]\\.,;:\s@\""]+"
                + @"(\.[^<>()[\]\\.,;:\s@\""]+)*)|(\"".+\""))@"
                + @"((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"
                + @"\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+"
                + @"[a-zA-Z]{2,}))$";

        [Required(ErrorMessage = "Email address is required")]
        [RegularExpression(EMAIL_REGEX, ErrorMessage = "Not a valid email address")]
        public string Email { get; set; }

        [Required(ErrorMessage = "Message content is required.")]
        [MaxLength(500, ErrorMessage = "Message must be no more than 500 characters")]
        public string Content { get; set; }
    }
}